<template>
  <div class="app-container">
    <div class="filter-container default-box">
      <span>ID：</span>
      <el-input v-model="listQuery.title" placeholder="请输入ID" style="width: 240px;" class="filter-item" />
      <span style="padding-left: 100px;">日期：</span>
      <el-date-picker v-model="datevalue" type="date" placeholder="选择日期" />
      <span style="padding-left: 100px;">类型：</span>
      <el-radio-group v-model="radio" size="medium">
        <el-radio :label="0">全部</el-radio>
        <el-radio :label="1">增加</el-radio>
        <el-radio :label="2">减少</el-radio>
      </el-radio-group>
      <el-button class="filter-item" type="primary" icon="el-icon-search" style="margin-left:50px" round>
        查询
      </el-button>
      <el-button class="filter-item" icon="el-icon-refresh-right" round>
        重置
      </el-button>
    </div>
    <div class="default-box">
      <el-table
        :key="tableKey"
        v-loading="listLoading"
        :data="list"
        fit
        highlight-current-row
        style="width: 100%;"
      >
        <el-table-column label="ID" sortable>
          <template>
            <span>680442944209162200</span>
          </template>
        </el-table-column>
        <el-table-column label="分红日期">
          <template>
            <span>2023-03-03</span>
          </template>
        </el-table-column>
        <el-table-column label="变化类型">
          <template>
            <span>增加</span>
          </template>
        </el-table-column>
        <el-table-column label="变化额度">
          <template>
            <span>1000.0000</span>
          </template>
        </el-table-column>
        <el-table-column label="变化前额度">
          <template>
            <span>1000.0000</span>
          </template>
        </el-table-column>
        <el-table-column label="预计分红额度">
          <template>
            <span>1000.0000</span>
          </template>
        </el-table-column>
        <el-table-column label="实际分红额度">
          <template>
            <span>1000.0000</span>
          </template>
        </el-table-column>
        <el-table-column label="实际销毁额度">
          <template>
            <span>1000.0000</span>
          </template>
        </el-table-column>
        <el-table-column label="创建时间">
          <template>
            <span>1970-01-01 08:00:00</span>
          </template>
        </el-table-column>
      </el-table>
      <pagination v-show="total>0" :total="total" :page.sync="listQuery.page" :limit.sync="listQuery.limit" @pagination="getList" />
    </div>
  </div>
</template>

<script>
import { fetchList } from '@/api/article'
import Pagination from '@/components/Pagination' // secondary package based on el-pagination
export default {
  name: 'Adminrole',
  components: { Pagination },
  data() {
    return {
      tableKey: 0,
      list: null,
      total: 0,
      listLoading: true,
      listQuery: {
        page: 1,
        limit: 10,
        importance: undefined,
        title: undefined,
        type: undefined,
        sort: '+id'
      },
      datevalue: '', // 选择日期
      radio: 0 // 选择的类型
    }
  },
  created() {
    this.getList()
  },
  methods: {
    getList() {
      this.listLoading = true
      fetchList(this.listQuery).then(response => {
        this.list = response.data.items
        this.total = response.data.total
        setTimeout(() => {
          this.listLoading = false
        }, 1.5 * 1000)
      })
    }
  }
}
</script>
<style scoped>
  [class^=el-icon-], [class*=" el-icon-"]{
    font-size: 16px;
  }
  .small-padding i{
    margin-right: 12px;
  }
  .small-padding i:last-child{
    margin-right: 0px;
  }
  ::v-deep .filter-container .el-input--medium .el-input__inner{
    width: 240px;
  }
</style>
